/**
 * Created by Tim on 2017/5/23.
 */
$(function () {
    var add_btn=$("#add_btn");
    var back_btn=$("#back_btn");
    var roleName=$("#roleName");
    var roleCode=$("#roleCode");
    var add_distributor_form=$("#add_distributor_form");


    function RoleMgr() {

    }

    RoleMgr.prototype.Constructor = RoleMgr;

    add_btn.on("click",function () {
        $(this).addClass("disabled");

        if (_isValid())
            add_distributor_form.submit();

        add_btn.removeClass("disabled");

    });
    back_btn.on("click",function () {
      window.history.go(-1);
    });
    
    function _isValid() {

        if (roleName.val()==''){
            name.focus();
            BootBox.warning("请输入角色名！");
            return false;
        }
        if (roleCode.val()==''){
            notifyUrl.focus();
            BootBox.warning("请输入角色码！");
            return false;
        }
        return true;
    }

    window.RoleMgr = new RoleMgr();
});